#include "widget.h"
#include "ui_widget.h"
#include <iostream>
using namespace  std;

double division(int a, int b)
{
   if( b == 0 )
   {
      throw "Division by zero condition!";
   }
   return (a/b);
}

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    int x = 50;
    int y = 0;
    double z = 0;

    try {
      z = division(x, y);
      cout << "1"<<z << endl;
    }catch (const char* msg) {
      cerr <<"2" <<msg << endl;
    }
}

Widget::~Widget()
{
    delete ui;
}
